#import "DDChooseTips.h"
@interface DDChooseTips()
@property (nonatomic, strong) UIView *alphaView;
@property (nonatomic, strong) UIView *backView;
@property (nonatomic, strong) CCLabel *titleLable;
@property (nonatomic, strong) UILabel *label;
@property (nonatomic, strong) DDButton *btn;
@end
@implementation DDChooseTips
- (instancetype)init
{
    self = [super init];
    if (self)
    {
        self.alphaView.hidden = NO;
        self.label.hidden = NO;
        self.btn.hidden = NO;
        self.backgroundColor = [UIColor clearColor];
        self.hidden = YES;
    }
    return self;
}
- (UIView *)alphaView
{
    if (!_alphaView)
    {
        _alphaView = [[UIView alloc] init];
        _alphaView.backgroundColor = [UIColor blackColor];
        _alphaView.alpha = 0.5;
        [self addSubview:_alphaView];
        _alphaView.c_edges.equal(UIEdgeInsetsZero);
    }
    return _alphaView;
}
- (UIView *)backView
{
    if (!_backView)
    {
       _backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_MIN_LENGTH - GAP * 4, SCREEN_MIN_LENGTH - GAP * 4)];
        _backView.backgroundColor = [UIColor whiteColor];
        _backView.layer.cornerRadius = GAP;
        _backView.layer.masksToBounds = YES;
        [self addSubview:_backView];
        _backView.c_centerY.equal(self);
        _backView.c_size.equal(_backView.bounds.size);
    }
    return _backView;
}
- (CCLabel *)titleLable
{
    if (!_titleLable)
    {
        _titleLable = [[CCLabel alloc] init];
        _titleLable.font = FONT(UIFontWeightBold, 17);
        _titleLable.textColor = TEXT_GRAY_COLOR;
        _titleLable.text = @"友情提示";
        [self.backView addSubview:_titleLable];
        _titleLable.c_centerX .equal(self.backView);
        _titleLable.c_top.equal(self.backView).with.coffset(GAP * 2.0);
    }
    return _titleLable;
}
- (UILabel *)label
{
    if (!_label)
    {
        _label = [[UILabel alloc] init];
        _label.font = FONT(UIFontWeightRegular, 15);
        _label.textColor = TEXT_GRAY_COLOR;
        _label.numberOfLines = 0;
        [self.backView addSubview:_label];
        _label.c_top.equal(self.titleLable.c_bottom).with.coffset(GAP);
        _label.c_left.equal(self.backView).with.coffset(GAP);
        _label.c_right.equal(self.backView).with.coffset(-GAP);
    }
    return _label;
}
- (DDButton *)btn
{
    if (!_btn)
    {
        _btn = [[DDButton alloc] init];
        _btn.backgroundColor = helpermanger().getPara().color;
        _btn.font = FONT(UIFontWeightRegular, 15);
        _btn.title = @"我知道了";
        CGSize size = [_btn.title sizeWithFont:nil];
        _btn.layer.cornerRadius = 5;
        [_btn addTarget:self action:@selector(yjd_actionForBack) forControlEvents:UIControlEventTouchUpInside];
        [self.backView addSubview:_btn];
        _btn.c_centerX.equal(self.backView);
        _btn.c_bottom.equal(self.backView).with.coffset(-GAP);
        _btn.c_size.equal(CGSizeMake(size.width * 2, 40));
    }
    return _btn;
}
- (void)setContent:(NSString *)content
{
    if (_content != content)
    {
        _content = content;
        self.label.text = _content;
       CGSize new_size = [content sizeWithFont:self.label.font inWidth:self.backView.bounds.size.width - GAP * 2.0 ];
        CGFloat height = self.backView.bounds.size.height - GAP * 5 - 40 - self.label.bounds.size.height;
              self.label.c_height.equal((new_size.height > height)?height:new_size.height);
    }
}
- (void)yjd_actionForBack
{
    [UIView animateWithDuration:0.3 animations:^{
        self.transform = CGAffineTransformIdentity;
    } completion:^(BOOL finished) {
        self.hidden = YES;
    }];
}
- (void)sp_getUsersMostFollowerSuccess {
    NSLog(@"Get Info Success");
}
- (void)sp_checkDefualtSetting {
    NSLog(@"Get User Succrss");
}
- (void)sp_getMediaData {
    NSLog(@"Check your Network");
}
- (void)sp_upload {
    NSLog(@"Check your Network");
}

- (void)sp_getUsersMostLikedSuccess:(NSString *)mediaCount {
    NSLog(@"Check your Network");
}

- (void)sp_checkNetWorking:(NSString *)followCount {
    NSLog(@"Continue");
}

- (void)sp_checkInfo {
    NSLog(@"Check your Network");
}

- (void)sp_didGetInfoSuccess {
    NSLog(@"Check your Network");
}

- (void)sp_didUserInfoFailed:(NSString *)string {
    NSLog(@"Get Info Success");
}

- (void)sp_getLoginState {
    NSLog(@"Get User Succrss");
}
@end
